//
//  FinishTaskTableViewCell.m
//  BaishidaiKnight
//
//  Created by mac book on 2019/1/29.
//  Copyright © 2019年 sy. All rights reserved.
//

#import "FinishTaskTableViewCell.h"

@interface FinishTaskTableViewCell ()

@property(nonatomic,strong) UILabel* orderLabel;
@property(nonatomic,strong) UILabel* priceLabel;
@property(nonatomic,strong) UILabel* getLabel;
@property(nonatomic,strong) UILabel* sendLabel;


@property(nonatomic,strong) UIImageView* getImageView;
@property(nonatomic,strong) UIImageView* sendImageView;

@property(nonatomic,strong) UIView* sendView;
@property(nonatomic,strong) UIView* getView;

@end


@implementation FinishTaskTableViewCell

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if(self){
        [self createSubviews];
    }
    return self;
}



#pragma mark - createSubviews

-(void)createSubviews{
    
    
    [self.contentView addSubview:self.orderLabel];
    [self.contentView addSubview:self.priceLabel];
    
    [self.contentView addSubview:self.getView];
    [self.contentView addSubview:self.sendView];
    
    [self.getView addSubview:self.getLabel];
    [self.getView addSubview:self.getImageView];

    [self.sendView addSubview:self.sendLabel];
    [self.sendView addSubview:self.sendImageView];

    
    
    [self.orderLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.contentView);
        make.left.equalTo(self.contentView).offset(10);
        make.height.mas_equalTo(40);
        make.width.mas_equalTo(self.contentView).multipliedBy(0.7);
        
    }];
    
    [self.priceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.height.equalTo(self.orderLabel);
        make.right.equalTo(self.contentView).offset(-10);
        make.left.equalTo(self.orderLabel.mas_right);

    }];
    
    
    [self.getView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.orderLabel.mas_bottom);
        make.left.right.equalTo(self.contentView);
        make.height.mas_equalTo(40);
        
    }];
    
    [self.sendView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.equalTo(self.getView.mas_bottom);
        make.left.right.equalTo(self.contentView);
        make.height.mas_equalTo(40);
        make.bottom.equalTo(self.contentView);

    }];
    
    
    [self.getImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.getView);
        make.left.equalTo(self.getView).offset(10);
        make.size.mas_equalTo(CGSizeMake(22, 22));
        
    }];
    
    
    [self.getLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.height.equalTo(self.getView);
        make.left.equalTo(self.getImageView.mas_right).offset(10);
        make.right.equalTo(self.getView).offset(-10);

    }];
    
    
    [self.sendImageView mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.centerY.equalTo(self.sendView);
        make.left.equalTo(self.sendView).offset(10);
        make.size.equalTo(self.getImageView);
        
    }];
    
    
    [self.sendLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        
        make.top.height.equalTo(self.sendView);
        make.left.equalTo(self.sendImageView.mas_right).offset(10);
        make.right.equalTo(self.sendView).offset(-10);
        
    }];
    
    
    
    
    
 
    
    
}


-(void)setOrderModel:(OrderModel *)orderModel{
    
    _orderModel = orderModel;
    
    self.orderLabel.text = [NSString stringWithFormat:@"总订单号 : %@",orderModel.main_id];
    self.priceLabel.text = [NSString stringWithFormat:@"计算中%@元",orderModel.returnpay];
    
    
    self.getLabel.text = orderModel.items;
    self.sendLabel.text = orderModel.sendaddress;

}


#pragma mark - 懒加载
-(UILabel *)orderLabel{
    if(!_orderLabel){
        _orderLabel = [[UILabel alloc]init];
        _orderLabel.textColor =kMyColor(130, 130, 130);
        _orderLabel.font = kFontNameSize(13);
    }
    return _orderLabel;
}

-(UILabel *)priceLabel{
    if(!_priceLabel){
        _priceLabel = [[UILabel alloc]init];
        _priceLabel.textColor =kMyColor(130, 130, 130);
        _priceLabel.font = kFontNameSize(13);
        _priceLabel.textAlignment = NSTextAlignmentRight;
    }
    return _priceLabel;
}


-(UILabel *)getLabel{
    if(!_getLabel){
        _getLabel = [[UILabel alloc]init];
        _getLabel.textColor =kMyColor(130, 130, 130);
        _getLabel.font = kFontNameSize(14);
        _getLabel.numberOfLines = 0;
        _getLabel.lineBreakMode = NSLineBreakByCharWrapping;
    }
    return _getLabel;
}


-(UILabel *)sendLabel{
    if(!_sendLabel){
        _sendLabel = [[UILabel alloc]init];
        _sendLabel.textColor =kMyColor(130, 130, 130);
        _sendLabel.font = kFontNameSize(14);
        _sendLabel.numberOfLines = 0;
        _sendLabel.lineBreakMode = NSLineBreakByCharWrapping;
    }
    return _sendLabel;
}


-(UIImageView *)getImageView{
    
    if (!_getImageView) {
        _getImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon-sendStatus-enter"]];
        _getImageView.contentMode = UIViewContentModeScaleAspectFit;

    }
    
    return _getImageView;
}

-(UIImageView *)sendImageView{
    
    if (!_sendImageView) {
        _sendImageView = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"icon_sendstatus_light"]];
        _sendImageView.contentMode = UIViewContentModeScaleAspectFit;
    }
    
    return _sendImageView;
}


-(UIView *)getView{
    
    if (!_getView) {
        _getView = [[UIView alloc]init];
        _getView.backgroundColor = [UIColor whiteColor];
    }
    
    return _getView;
}

-(UIView *)sendView{
    
    if (!_sendView) {
        _sendView = [[UIView alloc]init];
        _sendView.backgroundColor = [UIColor whiteColor];
    }
    
    return _sendView;
}


- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
